window.onload = function() {
	init();
	typeSelect();
	companyTouch();
};

function init(){
	
	var business = $("div.business");
	var length = business.length;
	
	for(var i=1; i<length; i++){
		business[i].style.display = "none";
	}
	
	allComnanyHidden();
}

function typeSelect(){
	var type_select = $("#type_select")[0];
	
	type_select.onchange = function(){
		typeChange(this.value);
	};
	
}

function typeChange(index){
	var business = $("div.business");
	var length = business.length;
	
	for(var i=0; i<length; i++){
		business[i].style.display = "none";
	}
	
	business[index].style.display = "block";
}

function allComnanyHidden(){
	$("dl.company dd.infomation").css("display", "none"); 
}

function companyTouch(){

	var company_name = $("dt.company_name");
	var length = company_name.length;
	
	$("dt.company_name").css("cursor", "pointer");
	
	for(var i=0; i<length; i++){
		company_name[i].onclick = function(){
			var infomation = this.parentNode.getElementsByTagName("dd")[0];
			
			if(infomation.style.display == "block"){
				allComnanyHidden();
			}else{
				allComnanyHidden();
				infomation.style.display = "block";
			}
		}; 
	}
	
}